import java.util.Scanner;

public class Test {
    public static void main(String[] args) {

    }
    public static void main16(String[] args) {
        Scanner scaner  = new Scanner(System.in);
        int sc = scaner.nextInt();
        for (int i = 0; i < sc ; i++) {
            for (int j = 0;j < sc;j++){
                if(i == j || (i + j) == sc -1){
                    System.out.print("*");
                }else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
    public static void main15(String[] args) {
        int [] array = new int[100];
        int i = 0;
        for( i = 0; i < array.length;i++) {
            array[i] = i + 1;
            System.out.println(array[i]);

        }
    }
    public static int max(int a,int b){
        return Math.max(a,b);
    }

    public static void main14(String[] args) {
        int ret =  max(3,8);
        System.out.println(ret);
    }
    public static int add(int a,int b){
        return a+b;
    }
    public static double add(double a, double b, double c){
        return a+b+c;
    }
    public static void main13(String[] args) {
        //方法的重载
        int ret = add(4,8);
        double ret2 = add(2.1,3.1,4.1);
        System.out.println(ret);
        System.out.println(ret2);
    }


    public static void main12(String[] args) {
        //斐波那契数列
        Scanner scanner = new Scanner(System.in);
        int sc = scanner.nextInt();//第几项
        if(sc <= 2){
            System.out.println(1);
        }

        int flg1 = 1;
        int flg2 = 1;
        int flg3 = 1;
        for(int i = 3; i <= sc; i++){
            flg3 = flg2 + flg1;
            flg1 = flg2;
            flg2 = flg3;

        }
        System.out.println(flg3);


    }
    public static void main11(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int sc = scanner.nextInt();
        int tmp = 1;
        int sum = 0;
        for (int i = 1 ; i < sc; i++){
            tmp *= i;
            sum += tmp;
        }
        System.out.println(sum);
    }
    public static void main10(String[] args) {
        //求N的阶乘
        Scanner scanner = new Scanner(System.in);
        int sc = scanner.nextInt();
        int sum = 1;
        for (int i = 1 ; i < sc + 1 ;i++){
            sum *= i;
        }
        System.out.println(sum);
    }

    public static void main9(String[] args) {
        double i;
        double sum = 0;
        int flag = 1;

        for ( i = 1; i <101 ; i++) {
            sum += 1 / i * flag;
            flag = - flag;
        }
        System.out.println(sum);
    }
    public static void main8(String[] args) {
        for(int i = 1; i < 99999; i++){
            int count  = 0;
            int tmp = 0;
            tmp = i;
            while( tmp != 0){
                tmp /= 10;
                count++;
            }
            tmp = i;
            int sum = 0;
            while(tmp != 0){
                sum += Math.pow(tmp % 10,count);
                tmp /=10;

            }
            if(sum == i){
                System.out.println(i);
            }
        }
    }
    public static void main7(String[] args) {
        int ret = max23(44,55);
        int ret2 = max33(44,55,78);
        System.out.println(ret);
        System.out.println(ret2);
    }
    //函数嵌套
    public static int max23(int a,int b){
        return a > b? a:b;
    }
    public static int max33(int a,int b,int c){
        int max = max2(a,b);
        return max > c? max : c;
    }

    public static int max2(int a, int b){
        return a > b? a:b;

    }
    public static int max3(int a,int b,int c){
        int max = max2(a,b);
        return max > c ? max : c;

    }
    public static void main6(String[] args) {
        int ret1 = max2(2,3);
        int ret2 = max3(2,3,4);
        System.out.println(ret1);
        System.out.println(ret2);

    }
    public static void main5(String[] args) {
        double i = 0;
        int flag = -1;
        double sum = 0;
        for (i = 1; i <= 100; i++){
            sum += 1 / i * flag;
            flag = -flag;
        }
        System.out.println(sum);
    }
    


    public static int func(int i ,int count){
        while(i != 0){
            i = i & (i-1);
            count++;
        }
        return count;
    }
    public static void main4(String[] args) {
        //写一个函数返回二进制中1的个数
        int i = 0;
        int count = 0;
        int ret = func(15,0);
        System.out.println(ret);

    }

        public static void main3(String[] args) {
            for (int i = 0; i < 999999; i++) {
                int tmp = 0;
                int count = 0;
                tmp = i;
                while (tmp != 0) {
                    tmp /= 10;
                    count++;
                }
                tmp = i;
                int sum = 0;
                while (tmp != 0) {
                    sum += Math.pow(tmp % 10, count);
                    tmp /= 10;
                }
                if (i == sum) {
                    System.out.println(i);
                }
            }
        }

        public static void main2 (String [] args){

            for (int i = 1; i < 9999999; i++) {
                int tmp = i;
                int count = 0;
                while (tmp != 0) {
                    count++;

                    tmp /= 10;
                }
                tmp = i;
                int sum = 0;
                while (tmp != 0) {
                    sum += Math.pow(tmp % 10, count);
                    tmp /= 10;
                }
                if (i == sum) {
                    System.out.println(i);
                }
            }

        }
        public static void main1 (String[] args){
            //求1-99999999水仙花数目
            //首先产生1-999999999的数字
            //判断这个数字有几位


            for (int i = 1; i < 9999999; i++) {
                //每一次循环count都要置零
                int count = 0;
                int tmp = 0;
                tmp = i;
                while (tmp != 0) {
                    count++;
                    tmp /= 10;
                }
                //求这个数字的每一位
                int sum = 0;
                tmp = i;
                while (tmp != 0) {
                    sum += Math.pow(tmp % 10, count);
                    tmp /= 10;
                }
                if (sum == i) {
                    System.out.println(i);
                }

            }


        }

    }